<?php defined('_VALID_MOS') or die('Direct Access to this location is not allowed.'); ?>

<form action="index2.php" method="post" name="adminForm">
    <table cellpadding="4" cellspacing="0" border="0" width="100%">
        <tr>
            <td width="100%" class="sectionname">Teammanager</td>
            <td nowrap="nowrap">
                <fieldset>
                    <legend>QuickAdd</legend>
                    <input type="text" name="team_name"  size="25" value="" class="inputbox" />
                    <input type="button" name="" class="button" value="Save" onClick="javascript:submitbutton('quickadd');" />
                </fieldset>
            </td>
            <td nowrap="nowrap">
                <fieldset>
                    <legend>Search</legend>
                    <input type="text" name="search" value="<?php echo $this->search; ?>" class="inputbox" onChange="document.adminForm.submit();" />
                    <input type="submit" class="button" value="search">
                </fieldset>
            </td>
        </tr>
    </table>

    <table class="adminlist">
        <tr>
            <th width="1%">
                <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($this->rows); ?>);" />
            </th>
            <th width="5%" nowrap="nowrap"><?php echo 'Id'; ?></th>
            <th width="5%" nowrap="nowrap"><?php echo 'Logo'; ?></th>
            <th class="title" width="25%" nowrap="nowrap"><?php echo 'Name'; ?></th>
            <th class="title" width="20%" nowrap="nowrap"><?php echo 'Shortname'; ?></th>
            <th class="title" width="25%" nowrap="nowrap"><?php echo 'Info'; ?></th>
            <th width="24%" nowrap="nowrap"><?php echo 'Action'; ?></th>
        </tr>
        <?php
        $k = $i = 0;
        foreach ($this->rows AS $row) {

            $team = LM::getLMTable("Team");
            $team->populate($row);
        ?>
            <tr class="<?php echo "row$k"; ?>">
                <td align="center">
                    <input type="checkbox" id="cb<?php echo $i; ?>" name="cid[]" value="<?php echo $team->getID(); ?>" onclick="isChecked(this.checked);" />
                </td>
                <td align="center"><b><?php echo $team->getID(); ?></b></td>
                <td>
                    <div align="center">
                    <?php $this->plugin("thumb", "logos", $team->getLogo(), 28, 28); ?>
                </div>
            </td>
            <td>
                <a href="#edit" onclick="return listItemTask('cb<?php echo $i; ?>','edit')" onmouseover="this.T_DELAY=50;return escape('<b><?php echo $team->getName(); ?></b>: Edit this Team!')">
                    <?php echo $team->getName(); ?>
                </a>
            </td>
            <td><?php echo $team->getShortName(); ?></td>
            <td><?php echo $team->getInfo(); ?></td>
            <td align="center">
                <?php
                    if (is_a($this->project, 'LM_Table_Project')) {
                        if (@$row->teammap_team) {
                            echo "&nbsp;";
                        } else {
                ?>
                            <a href="#assign" onClick="return listItemTask('cb<?php echo $i; ?>', 'assign')">assign</a>
<?php
                        }
                    }
?>
                </td>
            </tr>
<?php
                    $k = 1 - $k;
                    $i++;
                }
?>
            </table>
<?php echo $this->pageNav->getListFooter(); ?>
    <input type="hidden" name="option" value="com_leagueman" />
    <input type="hidden" name="act" value="teams" />
    <input type="hidden" name="task" value="" />
    <input type="hidden" name="boxchecked" value="0" />
</form>